$(".bar__mobile_open_menu").on("touchstart", function(e) { $(".left_sidebar_overlay").toggleClass("left_sidebar_overlay--open"); $(".left_sidebar").toggleClass("left_sidebar--open"); e.preventDefault(); }); $(".left_sidebar_overlay").on("touchstart", function(e) { $(".left_sidebar").toggleClass("left_sidebar--open"); $(".left_sidebar_overlay").toggleClass("left_sidebar_overlay--open"); //$(".left_sidebar_overlay").css("display", "none"); //e.preventDefault(); }); $(".article_book img").on("click", function() { var url_image = $(this).attr("src"); var url = window.location.href ; var title = $(document).find("h1").text(); dawd(url, $(this).dom[0].naturalWidth, $(this).dom[0].naturalHeight, title, url, url_image, $(this)[0]); console.log("open photo"); }); $("a").on("click", function() { showMessage("Загружаем...", '
', true); }); function showMessage(title, text, preloader) { //var html = ''; $(".modal-title").html(title); $(".modal-text").html(text); if (preloader) $(".modal-buttons").remove(); $(".modal-ios").addClass("modal-in"); $(".modal-overlay").addClass("modal-overlay-visible"); } function hideMessage() { $(".modal-ios").removeClass("modal-in"); $(".modal-overlay").removeClass("modal-overlay-visible"); } function dawd(url, width, height, title, post_url, url_image, obje) { //$(".bar").hide(); var pswpElement = document.querySelectorAll('.pswp')[0]; // build items array var items = [{ src: url_image, w: width, h: height, title: title }]; // define options (if needed) var options = { history: false, focus: true, closeOnScroll: false, mouseUsed: true, shareEl: false, clickToCloseNonZoomable:false, showAnimationDuration: 0, hideAnimationDuration: 0, maxSpreadZoom: 15, shareButtons: [ { id: 'facebook', label: 'Поделиться ВКонтакте', url: 'https://vk.com/share.php?url=' + post_url }, { id: 'twitter', label: 'Твитнуть', url: 'https://twitter.com/intent/tweet?text={{text}}&url=' + post_url }, { id: 'download', label: 'Скачать эту картинку', url: '{{raw_image_url}}', download: true } ] }; var gallery = new PhotoSwipe(pswpElement, PhotoSwipeUI_Default, items, options); gallery.init(); gallery.listen('close', function() { // $(".bar").fadeIn(250); }); }; function addBookmarkForBrowser() { var success=false; // try each until all fail... try { window.external.AddFavorite(window.location, document.title); success=true; } catch(e) {} try { window.sidebar.addPanel(document.title,location.href,''); success=true; } catch(e) {} if(!success) { alert("НАЖМИТЕ CTRL+D, чтобы добавить сайт в закладки!"); } }